<#-- 导入变量定义文件 -->
<#include "../template/template_listPage.ftl">
<@header title="特价模板管理">
<script type="text/javascript">
    $().ready(function () {
		<#if actionErrors??&&(actionErrors?size > 0)>
			$.dialog({type: "warn", content: "<#list errorMessages as list>${list}<br></#list>",
			 modal: true, autoCloseTime: 3000});
		</#if>

    });

    function addPT() {
        var url = "${web_base}/recharge/price_template!doAdd.htm";
        document.forms[0].action = url;
        document.forms[0].submit();
    }

    function edit(id) {
        var name = $('#' + id).val();
        if (id != undefined && id != '' && name != undefined && name != '') {
            name = encodeURI(name);
            var data = 'id=' + id + '&name=' + name;
            $.ajax({
                type:"POST",
                url:"${web_base}/recharge/price_template!doEdit.htm",
                data:data,
                success:function (data) {
                    var dataObj = eval("(" + data + ")");
                    if (dataObj.result == "success") {
                        var id = data.id;
                        if (id != null && id != '') {
                            $('#' + webId).val(id);
                        }
                        $.dialog({type: "warn", content: "操作成功!",modal: true, autoCloseTime: 3000});
                    } else if (dataObj.result == "error") {
                        var name = $('#name_' + webId).text();
                        $.dialog({type: "warn", content: name + "操作失败!",modal: true, autoCloseTime: 3000});
                    }
                }
            });
        }
    }
</script>
</@header>
<body class="list">

<div class="body">
    <div class="listBar">
        <h1><span class="icon">&nbsp;</span>特价模板管理&nbsp;</h1>
    </div>
<@pageList page=(page!) id="listForm" query="ptq" isEmpty=true >
    <div class="operateBar">
        &nbsp;&nbsp;&nbsp;&nbsp;
        <input type="text" id="priceTemplateName" name="pt.name" value=""/>
        <button type="button" onclick="addPT();">新增</button>
    </div>
    <table class="listTable">
        <tr>
            <th>
                <span class="sort">序号</span>
            </th>
            <th>
                <span class="sort">模板名称</span>
            </th>
            <th>
                <span class="sort">操作</span>
            </th>
        </tr>
        <#if  page??&&page.list??&&(page.list?size gt 0) >
            <#list page.list as obj>
                <tr>
                    <td>${obj_index+page.pageSize*(page.currentPage-1)+1}</td>
                    <td><input type="text" id="${obj.id!}" value="${(obj.name)!}" style="width: 90%;"/></td>
                    <td>
                        <span onclick="edit('${obj.id!}');" title="保存" class="spanLink">[保存]</span>
                        <a href="${web_base}/recharge/price_template_special!list.htm?templateCode=${obj.id!}" onclick="" title="设置">[设置]</a>
                    </td>
                </tr>
            </#list>
        </#if>
    </table>
</@pageList>
</div>
</body>
